package com.HandleExceptioin;


public class MyException extends RuntimeException {
    private ExceptionEnum exceptionEnum;

    public MyException(ExceptionEnum exceptionEnum) {
        this.exceptionEnum = exceptionEnum;
    }

    public ExceptionEnum getExceptionEnum() {
        return exceptionEnum;
    }
    //用来输出异常信息和状态码
    public void printException(MyException e){
        ExceptionEnum exceptionEnum = e.getExceptionEnum();
        System.out.println("异常代码：" + exceptionEnum.getCode() + ",异常信息：" + exceptionEnum.getMessage());
    }
}
